home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17656 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
  2. From: grantp@usa.pipeline.com(Pete Grant)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Pure virtual destructors?
  5. Date: 16 Apr 1996 23:38:26 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4l1b1i$7c3@news1.h1.usa.pipeline.com>
  8. References: <4kuq0i$p6t@ftp.ee.vill.edu>
  9. NNTP-Posting-Host: 38.8.120.13
  10. X-PipeUser: grantp
  11. X-PipeHub: usa.pipeline.com
  12. X-PipeGCOS: (Pete Grant)
  13. X-Newsreader: Pipeline v3.5.0
  14.  
  15. On Apr 16, 1996 00:35:30 in article <Pure virtual destructors?>,
  16. 'sheridan@monet.vill.edu' wrote: 
  17.  
  18.  
  19. >The rule with destructors is that they are always overridden, right? 
  20.  
  21. No. In fact, you may substitute 'never' for 'always'. 
  22.   
  23. >That's a quote from VC4 docs, BTW.  When I do this: 
  24. >class CBase { 
  25. >public: 
  26. >virtual ~CBase() = 0; 
  27. >...}; 
  28. >class CChild : public CBase { 
  29. >public: 
  30. >~CChild(); 
  31. >...}; 
  32. >and declare a body for ~CChild, I always get unresolved external on 
  33. >CBase::~CBase.  I have seen this in several cases.  My guess is it's not 
  34. >a compiler bug, so what am I missing? 
  35. >Thanks. 
  36. >Pete Sheridan 
  37. Destructors are a special breed of functions in that they are 
  38. called for all inherited classes whether or not you have 
  39. defined a destructor for a derived class.  They are never 
  40. inherited.  Of course, the preceding assumes that the objects 
  41. in question are being properly destructed. 
  42.  
  43. Since all base class destructors are being called, you can't 
  44. have a pure virtual destructor without a body. 
  45.  
  46. -- 
  47. Pete Grant 
  48. Kalevi, Inc. 
  49. Software Engineering & development
  50.